home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / imengv3.41p2.lha / ImEngV3.41p2 / Extra / DOpus5 / arexx / IE_Import.dopus5 < prev   
Text File  |  1996-08-18  |  3KB  |  88 lines

  1. /*
  2. ** $VER: IE_Import.dopus5 1.02 (11/8 Stockholm/Sweden)
  3. ** Copyright © 1996 by Patrik M Nydensten 
  4. **
  5. ** Imports all selected image files in the SRCE directory into IE.
  6. ** Requires Image Engineer 3.0 or higher and DOpus 5.0 or higher.
  7. ** Call: (AREXX) DOpus5:arexx/IE_Import.dopus5 {Qp}
  8. */
  9.  
  10. options results
  11. signal on syntax
  12. lf='0a'x
  13.  
  14. parse arg portname
  15. if left(portname,5)='DOPUS' then address value portname
  16. else exit
  17.  
  18. if ~show(ports,'IMAGEENGINEER') then do
  19.      dopus request '"Could not locate IEs arexx port!" OK'
  20.   exit                 
  21. end                 
  22.  
  23. lister query source                /* get source handler */
  24. parse var result handle nil
  25. if RC~= 0 then exit
  26.  
  27. lister query handle selfiles ':'   /* get selected file names */
  28. sel_files = result
  29.  
  30. lister query handle numselfiles    /* get number of selected files */
  31. num_files = result
  32. if num_files = 0 then exit
  33.  
  34. lister query handle path           /* get current file path */
  35. file_path = strip(result,B,'"')
  36.  
  37. lister set handle progress num_files 'Importing images...'
  38.  
  39. do i = 1 to num_files  /* load loop */
  40.  
  41.   address value portname
  42.  
  43.   parse var sel_files image_file ':' sel_files
  44.   image_file = strip(image_file,B,'"')
  45.  
  46.   lister set handle progress name image_file  /* update progress display */
  47.   lister query handle abort                   /* check if aborted */
  48.   if result then do
  49.     lister clear handle progress  /* exit progress display mode */
  50.     lister refresh handle 'full'  /* update lister display */
  51.     dopus request '"User aborted..." OK'
  52.     lister clear handle abort
  53.     exit
  54.   end
  55.  
  56.   address 'IMAGEENGINEER'
  57.   'OPEN' '"'||file_path||image_file||'"' 'COLOUR'
  58.   if (RC ~= 0) then do
  59.     address value portname
  60.        dopus request '"Failed to load image' image_file 'into IE!" OK'
  61.   end
  62.   else do
  63.     address value portname
  64.     lister select handle image_file off  /* delselect file if used */
  65.   end
  66.  
  67.   address value portname
  68.   lister set handle progress count i    /* update progress display */
  69.   lister refresh handle full            /* update lister display */
  70.  
  71. end  /* end of load loop */
  72.  
  73. lister clear handle progress    /* exits progress display mode */
  74. lister refresh handle full      /* update lister display */
  75.  
  76. exit
  77.  
  78. /* Procedures */
  79.  
  80. Syntax:
  81.   syntax_rc = rc
  82.   lister clear handle progress        /* exits progress display mode */
  83.   lister read dhandle '"'||dst_path||'"' force
  84.   dopus front
  85.   dopus request '"Internal error on line' SIGL || lf || 'Error:' syntax_rc errortext(syntax_rc) '" OK'
  86.   exit
  87. return 0
  88.